##
# Makefile for our C Kernel
#

AS=gcc
CC=gcc
LD=ld
CFLAGS=-fno-builtin -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs


all: boot.o kernel.o
	$(LD) -Tsetup.ld boot.o kernel.o -o kernel.elf

boot.o: boot.S multiboot.h
	$(AS) $(CFLAGS) -DASM -c $<

kernel.o: kernel.c multiboot.h
	$(CC) $(CFLAGS) -c $<

clean:
	@rm *.o kernel.elf

test:
	@qemu -M pc -fda disk.img -boot a

install:
	@sudo mount -o loop disk.img /mnt
	@sudo cp kernel.elf /mnt/boot
	@sudo umount /mnt

